home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_08
/
1008014a
< prev
next >
Wrap
Text File
|
1992-06-10
|
489b
|
29 lines
Listing 3 -- exit.c
/* exit function */
#include <stdio.h>
#include <stdlib.h>
#include "yfuns.h"
/* macros */
#define NATS 32
/* static data */
void (*_Atfuns[NATS])(void) = {0};
size_t _Atcount = {NATS};
void (exit)(int status)
{ /* tidy up and exit to system */
while (_Atcount < NATS)
(*_Atfuns[_Atcount++])();
{ /* close all files */
size_t i;
for (i = 0; i < FOPEN_MAX; ++i)
if (_Files[i])
fclose(_Files[i]);
}
_Exit(status);
}